package main

import (
	"bindolabs/lib/mylog"
	"fmt"
	"runtime/debug"
	"time"
)

var log = mylog.NewLogger("")

func main_log() {
	log.Start("main", "run logger test")
	add(3, 4)
	// add(3, 4)
	// go add(5, 4)
	// go add(0, 4)
	log.Endln("")
}

func add(a, b int) {
	// requestId := fmt.Sprintf("add(%d, %d)", a, b)
	// log.Lock.Lock()
	// defer log.Lock.Unlock()
	// logBackup := log

	log := mylog.LogInit("")
	// log := mylog.LogInit("")
	// log.Startln("add", a, b)
	// log.Println("add something")
	time.Sleep(time.Second)
	sub(b, a)
	sub(1, 1)
	log.Endln("result:", a+b)

	// log = logBackup
}

func sub(a, b int) {
	// mylog.GetCallStack()
	fmt.Printf("---->info:[%v]", string(debug.Stack()))
	// log.Startln("sub", a, b)
	// log.Println("sub something")
	// log.Endln("result:", a-b)
}

func main() {
	// tools.RunMain()
	main_log()
	time.Sleep(time.Second * 3)
}
